package com.itheima.myobjectstream;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class Test {
    public static void main(String[] args) throws IOException {
        //将一个对象进行写入本地文件
        Student stu = new Student("zhangsan", 23);
        //创建输入流的对象
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("myio\\a.txt"));
        //进行数据写入
        oos.writeObject(stu);
        //释放资源
        oos.close();
    }
}
